package string;

import java.util.Arrays;

public class Method1 {
    public static void main(String[] args) {
        //编码方式不同，汉字占用字节数不同。
        //utf-8 每个占3个字节
        //gbk 每个占2个字节
        String s = "hello世界";
        byte[] bytes = s.getBytes();//转字节数组
        char[] charArray = s.toCharArray();//转字符数组

        System.out.println(Arrays.toString(bytes));//[104, 101, 108, 108, 111, -28, -72, -106, -25, -107, -116]
        System.out.println(Arrays.toString(charArray));

        String a = "java";
        String b = "JAVa";
        System.out.println(a.equalsIgnoreCase(b));

        a = "   java   ";
        //字符串的修改方法必须重新指向
        a.trim();//只能去除半角空格，无法去除全角空格
        System.out.println(a.trim());


        String s5 = "　　java  ";
        System.out.println(s5.trim());
        //jkd11,去除全角和半角
//        System.out.println(s5.strip());
    }
}
